#!/usr/bin/env python
#
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from google.appengine.ext import db
from google.appengine.ext.db import djangoforms
from google.appengine.ext.webapp import template

import django.newforms as forms

from glp import users


class RegistrationForm(djangoforms.ModelForm):
  """Registration form for signing up new users.

  Fields:
    first_name: Users first name.
    last_name: Users last name.
    role: Role of user at school.
    school: School that user belongs to.
  """

  class Meta:
    model = users.user
   
  first_name = forms.CharField(label='Given Name')
  last_name = forms.CharField(label='Family Name')
  role = forms.ChoiceField(
    label='Who are you?',
    help_text="Tell us what you do at your school.",
    choices=(
      ('', 'Choose your job or role'),
      ('policymaker', 'Policymaker'),
      ('administrator', 'Administrator'),
      ('teacher', 'Teacher'),
      ('parent', 'Parent'),
      ('student', 'Student'),
      ('adult-learner', 'Adult Learner'),
      ('other', 'Other')))

  # TODO(rafek):Place in to model and load at runtime.
  school = forms.ChoiceField(
    label='Where are you?',
    help_text="Tell us the school which you attend, where you teach, or where your child attends.",
    choices=(
      ('', 'Select your school'),
      ('kist', 'Kigali Institute of Science and Technology'),
      ('kie', 'Kigali Institute of Education'),
      ('coe-kivuma', 'CoE Kivuma'),
      ('coe-rukara', 'CoE Rukara'),
      ('ttc-bicumbi', 'TTC Bicumbi'),
      ('ttc-byumba', 'TTC Byumba'),
      ('ttc-gacuba', 'TTC Gacuba II'),
      ('ttc-kirambo', 'TTC Kirambo'),
      ('ttc-matimba', 'TTC Matimba'),
      ('ttc-mbuga', 'TTC Mbuga'),
      ('ttc-mururu', 'TTC Mururu'),
      ('ttc-rubengera', 'TTC Rubengera'),
      ('ttc-save', 'TTC Save'),
      ('ttc-zaza', 'TTC Zaza'),
      ('other-school', 'Other school'),
      ('none', 'Not in school')))
